use super::*;

/// Type of TypeScript declaration for N-API exports
#[derive(Clone, Copy, Ord, PartialOrd, Eq, PartialEq)]
pub enum DtsTy {
	Type,
	Constructor,
	Const,
	Enum,
	Object,
	Func,
	StaticFunc,
}

/// Registration information for TypeScript declarations
pub struct RegDTS {
	pub name: &'static str,
	pub func: fn() -> &'static str,
	pub owner: Option<core::any::TypeId>,
	pub ty: DtsTy,
}
#[linkme::distributed_slice]
pub static DTS: [RegDTS];

/// Registration information for N-API functions
pub struct RegFuction {
	pub func: sys::napi_callback,
	pub name: &'static core::ffi::CStr,
}
#[linkme::distributed_slice]
pub static FUNCTIONS: [RegFuction];

/// Registration information for N-API constants
pub struct RegConst {
	pub func: fn(&Env) -> Result<'_, Value<'_>>,
	pub name: &'static core::ffi::CStr,
}
#[linkme::distributed_slice]
pub static CONSTS: [RegConst];

/// Registration information for type definitions
pub struct RegType {
	pub target: &'static str,
	pub name: &'static str,
}
#[linkme::distributed_slice]
pub static TYPES: [RegType];

/// Registration information for JavaScript classes
pub struct RegClass {
	pub id: core::any::TypeId,
	pub name: &'static core::ffi::CStr,
	pub func: sys::napi_callback,
	pub interface: bool,
}
#[linkme::distributed_slice]
pub static CLASSES: [RegClass];

/// Registration information for class methods and properties
pub enum RegMethod {
	Constructor {
		id: core::any::TypeId,
		func: sys::napi_callback,
	},
	Method {
		id: core::any::TypeId,
		name: &'static core::ffi::CStr,
		func: sys::napi_callback,
	},
	Value {
		id: core::any::TypeId,
		name: &'static core::ffi::CStr,
		func: fn(&Env) -> Result<'_, Value<'_>>,
	},
	Static {
		id: core::any::TypeId,
		name: &'static core::ffi::CStr,
		func: sys::napi_callback,
	},
	Getter {
		id: core::any::TypeId,
		name: &'static core::ffi::CStr,
		func: sys::napi_callback,
	},
	Setter {
		id: core::any::TypeId,
		name: &'static core::ffi::CStr,
		func: sys::napi_callback,
	},
}
#[linkme::distributed_slice]
pub static METHODS: [RegMethod];
